/**
 * @FileName ConcreteHandler.java
 * @Package com.designMode.chainOfResponsibility
 * -------------------------------------
 * @function Please write description of function
 * @Date 2016-1-6 下午2:56:46
 * -------------------------------------
 * Copyright (c) 2016,顾博君 All Rights Reserved.
 */
package com.designMode.chainOfResponsibility;

/**
 * @author 顾博君
 * @ClassName ConcreteHandler
 * @Date 2016-1-6 下午2:56:46
 * @Function 具体处理者
 */
public class ConcreteHandler extends Handler {
    private Level level;
    private Response response;

    public ConcreteHandler(Level _level, Response _response) {
        //设置自己的处理级别
        this.level = _level;
        this.response = _response;
    }

    @Override
    protected Level getHandlerLevel() {
        return level;
    }

    @Override
    protected Response echo(Request request) {
        // 完成处理逻辑
        System.out.println("处理者Level"
                + getHandlerLevel().getLevel() + "开始处理请求");
        System.out.println("完成处理逻辑 request.level="
                + request.getRequestLevel().getLevel());
        return response;
    }
}
